//
//  BEOrderDetailModel.swift
//  BEGlobalOiler
//
//  Created by KKING on 16/9/19.
//  Copyright © 2016年 Bullseye Energy pte ltd. All rights reserved.
//

import UIKit

class BEOrderDetailModel: NSObject {
    
    /*
     "companyId": "3806678427688370176",
     "equipmentId": "3818232777430663168",
     "payType": 1,
     "payTerm": 1,
     "issueDesc": "loo",
     "currency": "1",
     "photoNotes": "tox",
     "workPlace": 1,
     "workType": "1",
     "workPlaceName": "Land",
     "workTypeName": "Mechanical",
     "payTypeName": "Credit",
     "payTermName": "10 Days",
     "timeZone": 2
     */

    var id: String?
    
    var rigLocation: String?
    
    var orderSn: String?
    
    var rigId: String?
    
    var orderTalentRefVOList: [BEOrderTechModel] = [BEOrderTechModel]()
    
    var orderTime: String?
    var createTime: String?
    
    var expectStartTime: String?
    var expectEndTime: String?

    var requireStartTime: String?
    var requireEndTime: String?
    
    
    var orderStatusName: String?
    
    
    var orderStatus: Int = 0
    
    var companyName: String?
    
    var rigName: String?
    
    //后台缺少此字段
    var estimateAmount: Int = 0
    

    
    var companyId: String?
    
    init(dict: [String : AnyObject]) {
        super.init()
        setValuesForKeys(dict)
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {}
    
    override func setValue(_ value: Any?, forKey key: String) {
        if "orderTalentRefVOList" == key {
            if let jsonList = value as? [[String: AnyObject]]{
                var techModelList = [BEOrderTechModel]()
                for item in jsonList {
                    let techModel = BEOrderTechModel(dict: item)
                    techModelList.append(techModel)
                }
                orderTalentRefVOList = techModelList
                return
            }
        }
        return super.setValue(value, forKey: key)
    }
}


class BEOrderTechModel: NSObject {

    /*
     "equipmentVO": {
     "id": "3818232777430663168",
     "type": "3810968248057462784",
     "model": "3810968585392750592",
     "code": "1212",
     "name": "11221",
     "status": 1,
     "brandId": "3810615609541132288",
     "companyId": "3806678427688370176",
     "serialNumber": "1212",
     "typeName": "测试设备类型3",
     "modelName": "测试型号1",
     "brandName": "蒋虎测试品牌",
     "companyName": "中国移动"
     },
     */
    
    var id: String?
    
    var talentName: String?
    
    var major: String?
    
    var isNeedBox: Int = 0
    
    var employeeId: String?
    
    var mobile: String?
    
    var statusName: String?
    
    var price: Int = 0
    
    var remark: String?
    
    var orderId: String?
    
    var talentId: String?
    
    var status: Int = 0
    
    var photo: String?

    
    init(dict: [String : AnyObject]) {
        super.init()
        setValuesForKeys(dict)
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {}
    
    override func setValue(_ value: Any?, forKey key: String) {
        return super.setValue(value, forKey: key)
    }
}



